Skip to content

fix(agents): report unimplemented MCP routes as failures and fail closed on VERA errors - #2628

Draft
groupthinking wants to merge 3 commits into
mainfrom
fix/2168-mcp-routed-false-success
Draft

groupthinking wants to merge 3 commits into
mainfrom
fix/2168-mcp-routed-false-success

Conversation

@groupthinking

@groupthinking groupthinking commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Canonical issue

Closes #2666.

Refs #2168 (AUDIT-006). This is the MCP false-success/fail-closed slice; the broader exception audit remains open. The dedicated tracking issue scopes this fix; the broader audit remains open.

Result

Unimplemented MCP/internal/HTTP routes report explicit failure instead of success. Broken installed VERA components and failed security checks block stage execution.

Review corrections preserve failure proofs when a routed tool returns a non-dictionary or a failed status without an error key; cached credential verification failures are covered; the canonical video fixture is used. Current main 512a2558f73d6281b6a880548bedf140b7e30292 is integrated. Both Vercel configurations disable deployment for this exact review branch through git.deploymentEnabled.

The top-level missing VERA package remains optional. Import failures inside installed VERA are initialization errors. No real MCP client is introduced; the pipeline remains legacy/experimental.

Verification — November 12, 2026

Published head: 9332adffdb0eec086cb58e4c3ccb7b72448e638a. GitHub tree f6f95ff68cb7ac15cf56e3346e8496659c8e1faa exactly matches the local tested tree; branch ref readback verifies publication.

Python 3.12.14; pytest 9.2.0; pytest-asyncio 1.5.0.

env -u DATABASE_URL -u EVENTRELAY_SHARED_STATE_DATABASE_URL PYTHONPATH=src python -m pytest tests/unit/test_mcp_routed_false_success_2168.py tests/unit/test_agent_orchestrator.py tests/unit/test_deployment_handoff_failures.py tests/unit/test_antigravity_orchestration.py tests/unit/test_antigravity_backend.py tests/unit/test_one_click_deploy_precheck.py tests/unit/test_autonomous_video_processing.py -o addopts='' -o log_cli=false -q

147 passed, exit 0 after integration; one pre-existing unawaited-AsyncMock warning. The three new invalid-result proof cases failed against the prior source. The focused suite has 23 passing cases. Independent source review found no remaining blocking issue in these corrections. Whitespace checks pass; pre-existing Ruff findings remain (including unreachable-code findings in the baseline).

Remaining gates

Keep draft, unmerged and undeployed. Current-head hosted CI/security must complete; historical green checks do not establish current acceptance. The closing-keyword gate remains active. No live provider, database, model, deployment or production acceptance is claimed.

…sed on VERA errors

The MCP network returned {"status": "routed"} for mcp:// tools without
executing anything, so the pipeline deploy step (create_repo) could report
success without deploying. Unimplemented routes now return
status not_implemented with an error, and the pipeline treats failed /
error / not_implemented statuses as stage failures. VERA identity, gateway
and firewall exceptions, and VERA init failures, now block the stage.

Refs #2168
Copilot AI max review requested due to automatic review settings November 9, 2026 06:32
@linear-code
linear-code Bot marked this pull request as ready for review November 9, 2026 06:32
@vercel

vercel Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
v0-uvai Ready Ready Preview, v0 Nov 9, 2026 7:20am UTC

@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

⚠️ Repository reconciliation: this PR does not reference exactly one canonical issue.

Please add a Closes #<issue> reference in the PR description so it can be tracked against the delivery plan.

See governance: #898

Comment thread src/agents/pipeline_orchestrator.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Internal VERA import failures are still swallowed, leaving initialization errors unset and allowing pipeline stages to run without VERA checks.

4 open issues
What changed in this PR

This partial slice of #2168 improves failure reporting and security-error handling in the legacy EventRelay agent pipeline, complementing #2626’s exception-narrowing work. It does not implement MCP transport or change UVAI’s public workflow.

Changes:

  • Replace placeholder route responses with explicit not_implemented failures.
  • Recognize failed or malformed stage results and add fail-closed handling for VERA exceptions.
  • Add isolated regression tests for routing, pipeline reporting, and VERA failure paths.
File Description
tests/​unit/​test_mcp_routed_false_success_2168.py Adds regression coverage for false success and VERA exceptions.
src/​agents/​pipeline_orchestrator.py Classifies stage failures and blocks execution on VERA security-check errors.
src/​agents/​mcp_agent_network.py Returns explicit failures for routes without implemented handlers.

Review effort: Max

Comment thread src/agents/pipeline_orchestrator.py Resolved
Comment thread src/agents/pipeline_orchestrator.py Resolved
Comment thread src/agents/pipeline_orchestrator.py Resolved
…alization, the earlier handler returns None and bypasses the new fail-closed guard, allowing stages to run without security checks.

This commit fixes the issue reported at src/agents/pipeline_orchestrator.py:114-123

### Trigger and impact
An installed VERA component can raise `ImportError` or `ModuleNotFoundError` when a transitive dependency is missing or incompatible, including inside `get_identity_service()`. The preceding `except ImportError` treats this as VERA being absent, so no `VeraInitError` reaches the constructor. Both `_vera` and `_vera_init_error` remain `None`, and stages execute without VERA checks despite initialization having failed.

### Suggested patch and validation
The patch reserves the optional-package fallback for `ModuleNotFoundError` naming the top-level `vera` package; other import failures reach the initialization-failure handler. Added regression cases for both import-error variants fail before the patch and pass afterward; all 19 focused cases pass, and the genuinely absent-package fallback was checked separately. Validation used fake VERA modules on Python 3.15; the real VERA package is absent and the full suite was not run.

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: groupthinking <garveyht@gmail.com>
Normalize invalid routed results for failure proof recording, cover cached credential verification failures, use canonical video fixture, and disable previews for this exact review branch.

Refs #2168

This branch was successfully deployed

1 active (outdated) deployment
Preview — 9ee76796 Deployed Nov 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fail closed on unimplemented MCP routes and verifier errors

3 participants